package com.heima.behavio.controller.v1;


import com.heima.behavio.service.BhLikeService;
import com.heima.model.behavior.dtos.LikesBehaviorDto;
import com.heima.model.behavior.dtos.LoadBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
public class BhLikeController {

    @Autowired
    private BhLikeService bhLikeService;

    /**
     * 点赞接口状态
     * @param dto
     * @return
     */
    @PostMapping("/likes_behavior")
    public ResponseResult  likesBehavior(@RequestBody LikesBehaviorDto dto){
        return bhLikeService.LikesBehavior(dto);
    }

    /**
     * 根据传入的dto ,进行behavior回显
     * @param dto 包含articId  authorId
     * @return
     */
  @PostMapping("/article/load_article_behavior/")
    public ResponseResult loadArticleBehavior(@RequestBody LoadBehaviorDto dto){
        return bhLikeService.loadArticleBehavior(dto);
  }
}
